package com.example;

import javax.microedition.khronos.opengles.GL10;

import com.step.Step;
import com.step.graphic.Texture;
import com.step.scene.light.AmbientLight;
import com.step.sprite.Sprite3D;

public class AmbientLightExample extends BaseExample{
	Sprite3D sprite3d;
	AmbientLight ambientLight;
	
	@Override
	public void create() {
		sprite3d = new Sprite3D(new Texture("textures/logo.png"));
		ambientLight = new AmbientLight(1f,0f,0f,1f);
	}

	@Override
	public void update() {
		GL10 gl = Step.gl;
		gl.glClearColor(1, 1, 1, 1);
		// 打开灯光
		gl.glEnable(GL10.GL_LIGHTING);
		ambientLight.enable(gl);
		//sprite3d.translate(10, 10,-20);
		sprite3d.setScale(1.5f,1.5f,1.5f);
		sprite3d.rotate(2,2,2);
		sprite3d.draw(gl);
		// 关闭灯光
		gl.glDisable(GL10.GL_LIGHTING);
	}	
}
